News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.ettools.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 3
6.45 %6.45%
6.45% 4 / 62
 
ETTools
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 3
1.69 %1.69%
1.69% 1 / 59
 public function echoTable($table, $tableHead, $negativMessage, $bottom = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 35
 public function trimStringTo($string, $maxLength, $inFront = false)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 7
 public function getExternalToolList($course, $accessSettings = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 16


       1                 : <?php                                                                                                                   
       2                 :                                                                                                                         
       3                 :                                                                                                                         
       4                 : /*--------------------------------------------------------------------------+                                           
       5                 : This file is part of eStudy                                                                                             
       6                 : externaltools/classes/class.ettools.inc.php                                                                             
       7                 : - Modulgruppe:  ExternalTools                                                                                           
       8                 : - Beschreibung: Diese Datei enthällt die Klasse ETTools.                                                               
       9                 : - Version:      0.1 23/04/05                                                                                            
      10                 : - Autor(en):    Christian Gerhardt <case42@gmx.net>                                                                     
      11                 : +---------------------------------------------------------------------------+                                           
      12                 : This program is free software; you can redistribute it and/or                                                           
      13                 : modify it under the terms of the GNU General Public License                                                             
      14                 : as published by the Free Software Foundation; either version 2                                                          
      15                 : of the License, or any later version.                                                                                   
      16                 : +---------------------------------------------------------------------------+                                           
      17                 : This program is distributed in the hope that it will be useful,                                                         
      18                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                          
      19                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                           
      20                 : GNU General Public License for more details.                                                                            
      21                 : You should have received a copy of the GNU General Public License                                                       
      22                 :                                                                                                                         
      23                 : * along with this program; if not, write to the Free Software                                                           
      24                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                             
      25                 : +--------------------------------------------------------------------------*/                                           
      26                 : /**                                                                                                                     
      27                 :  * Diese Datei enthällt die Klasse ETTools.                                                                            
      28                 :  * @package eStudy.ExternalTools                                                                                        
      29                 :  * @version 1.0 13/10/05                                                                                                
      30                 :  * @author Christian Gerhardt <case42@gmx.net>                                                                          
      31                 :  */                                                                                                                     
      32                 :                                                                                                                         
      33                 : /**                                                                                                                     
      34                 : * Path to Root falls nicht gesetzt                                                                                      
      35                 : */                                                                                                                      
      36               1 : if (!defined('PATH_TO_ROOT'))                                                                                           
      37               1 :     define("PATH_TO_ROOT", "../../");                                                                                   
      38                 :                                                                                                                         
      39                 : /***/                                                                                                                   
      40               1 : require_once ("class.externaltool.inc.php");                                                                            
      41                 :                                                                                                                         
      42               1 : class ETTools {                                                                                                         
      43                 :     public function echoTable($table, $tableHead, $negativMessage, $bottom = null) {                                    
      44               0 :         echo "<table class='tableBorder'>\n";                                                                           
      45               0 :         if (count($table) > 0) {                                                                                        
      46               0 :             $style = "tableCell";                                                                                       
      47               0 :             if (is_array($table[0])) {                                                                                  
      48               0 :                 Output :: echoTableHead($tableHead, count($table[0][0]));                                               
      49               0 :             } else {                                                                                                    
      50               0 :                 Output :: echoTableHead($tableHead, count($table[0]));                                                  
      51                 :             }                                                                                                           
      52               0 :             foreach ($table as $row) {                                                                                  
      53               0 :                 echo "\t<tr>\n";                                                                                        
      54               0 :                 if (is_array($row)) {                                                                                   
      55               0 :                     if (is_array($row[0])) {                                                                            
      56               0 :                         $style = "tableCellHead";                                                                       
      57               0 :                         $row = $row[0];                                                                                 
      58               0 :                     } else {                                                                                            
      59               0 :                         $style = "tableCell";                                                                           
      60                 :                     }                                                                                                   
      61               0 :                     foreach ($row as $entry) {                                                                          
      62               0 :                         echo "\t\t<td class='$style'>\n";                                                               
      63               0 :                         echo "\t\t\t$entry\n";                                                                          
      64               0 :                         echo "\t\t</td>\n";                                                                             
      65               0 :                     }                                                                                                   
      66               0 :                 } else {                                                                                                
      67               0 :                     echo $row;                                                                                          
      68                 :                 }                                                                                                       
      69               0 :                 echo "\t</tr>\n";                                                                                       
      70               0 :             }                                                                                                           
      71               0 :             if ($bottom) {                                                                                              
      72               0 :                 echo "<tr>\n";                                                                                          
      73               0 :                 echo $bottom;                                                                                           
      74               0 :                 echo "</tr>\n";                                                                                         
      75               0 :             }                                                                                                           
      76               0 :         } else {                                                                                                        
      77               0 :             echo "<tr>\n";                                                                                              
      78               0 :             echo "<td class='text12'>$negativMessage</td>\n";                                                           
      79               0 :             echo "</tr>\n";                                                                                             
      80                 :         }                                                                                                               
      81               0 :         echo "</table>\n";                                                                                              
      82               0 :     }                                                                                                                   
      83                 :                                                                                                                         
      84                 :     public function trimStringTo($string, $maxLength, $inFront = false) {                                               
      85               0 :         if ($maxLength < 4)                                                                                             
      86               0 :             $maxLength = 4;                                                                                             
      87               0 :         if (strlen($string) > $maxLength) {                                                                             
      88               0 :             if ($inFront) {                                                                                             
      89               0 :                 return sprintf("...%s", substr($string, strlen($string) - $maxLength +3));                              
      90                 :             } else {                                                                                                    
      91               0 :                 return sprintf("%s...", substr($string, 0, $maxLength -3));                                             
      92                 :             }                                                                                                           
      93                 :         } else {                                                                                                        
      94               0 :             return $string;                                                                                             
      95                 :         }                                                                                                               
      96                 :     }                                                                                                                   
      97                 :                                                                                                                         
      98                 :     public function getExternalToolList($course, $accessSettings = null) {                                              
      99               0 :         global $db, $settings;                                                                                          
     100               0 :         $toolList = array ();                                                                                           
     101               0 :         $query = "SELECT * " . "FROM %set_tools AS t, %set_tooldata AS d " . "WHERE t.courseID ='%s' AND t.toolID=d.ID";
     102               0 :         $query = sprintf($query, $settings['dbPrefix'], $settings['dbPrefix'], Data::toMysql($course));                 
     103               0 :         $tools = $db->get_results($query, ARRAY_A);                                                                     
     104               0 :         if (count($tools) > 0) {                                                                                        
     105               0 :             foreach ($tools as $tool) {                                                                                 
     106               0 :                 if ($accessSettings) {                                                                                  
     107               0 :                     if (($accessSettings & $tool['userSignupSettings']) == $accessSettings) {                           
     108               0 :                         $toolList[$tool['toolID']] = new ExternalTool($tool);                                           
     109               0 :                     }                                                                                                   
     110               0 :                 } else {                                                                                                
     111               0 :                     $toolList[$tool['toolID']] = new ExternalTool($tool);                                               
     112                 :                 }                                                                                                       
     113               0 :             }                                                                                                           
     114               0 :         }                                                                                                               
     115               0 :         return $toolList;                                                                                               
     116                 :     }                                                                                                                   
     117                 : }                                                                                                                       
     118                 : ?>                                                                                                                      

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.